#pragma once
#include "iserversocket.h"
#include "cupid.h"

namespace cupid
{

class ServerSocket : public IServerSocket
{
public:
	ServerSocket(SOCKET sock) { m_sock = sock; m_len = 0; }
	~ServerSocket() { close(); }
public:
	IServerSocket*	getInterface() { return (IServerSocket*)this; }

protected: // interface
	virtual const char*	getPacket	(int* len);
	virtual bool		clearPacket	(int len);
	virtual bool		sendPacket(const char* pack, int len);
	virtual bool		isOpen		();
	virtual	void		close		();
	virtual int			getPeerIP	();
	virtual SOCKET		socket() { return m_sock; }
	virtual int			setBufSize(int sendSize, int rcvSize);

protected:
	SOCKET		m_sock;
	char		m_bufMsg[RECV_BUFFER_SIZE];
	int			m_len;
};
}
